/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package uk.ac.glam.wcsclient.wcs111.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EDataTypeEList;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

import uk.ac.glam.wcsclient.ows110.OnlineResourceType;

import uk.ac.glam.wcsclient.wcs111.ContentsType;
import uk.ac.glam.wcsclient.wcs111.CoverageSummaryType;
import uk.ac.glam.wcsclient.wcs111.Wcs111Package;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Contents Type</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link uk.ac.glam.wcsclient.wcs111.impl.ContentsTypeImpl#getCoverageSummary <em>Coverage Summary</em>}</li>
 *   <li>{@link uk.ac.glam.wcsclient.wcs111.impl.ContentsTypeImpl#getSupportedCRS <em>Supported CRS</em>}</li>
 *   <li>{@link uk.ac.glam.wcsclient.wcs111.impl.ContentsTypeImpl#getSupportedFormat <em>Supported Format</em>}</li>
 *   <li>{@link uk.ac.glam.wcsclient.wcs111.impl.ContentsTypeImpl#getOtherSource <em>Other Source</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ContentsTypeImpl extends EObjectImpl implements ContentsType {
	/**
	 * The cached value of the '{@link #getCoverageSummary() <em>Coverage Summary</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCoverageSummary()
	 * @generated
	 * @ordered
	 */
	protected EList<CoverageSummaryType> coverageSummary;

	/**
	 * The cached value of the '{@link #getSupportedCRS() <em>Supported CRS</em>}' attribute list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSupportedCRS()
	 * @generated
	 * @ordered
	 */
	protected EList<String> supportedCRS;

	/**
	 * The cached value of the '{@link #getSupportedFormat() <em>Supported Format</em>}' attribute list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSupportedFormat()
	 * @generated
	 * @ordered
	 */
	protected EList<String> supportedFormat;

	/**
	 * The cached value of the '{@link #getOtherSource() <em>Other Source</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getOtherSource()
	 * @generated
	 * @ordered
	 */
	protected EList<OnlineResourceType> otherSource;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ContentsTypeImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return Wcs111Package.Literals.CONTENTS_TYPE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<CoverageSummaryType> getCoverageSummary() {
		if (coverageSummary == null) {
			coverageSummary = new EObjectContainmentEList<CoverageSummaryType>(CoverageSummaryType.class, this, Wcs111Package.CONTENTS_TYPE__COVERAGE_SUMMARY);
		}
		return coverageSummary;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<String> getSupportedCRS() {
		if (supportedCRS == null) {
			supportedCRS = new EDataTypeEList<String>(String.class, this, Wcs111Package.CONTENTS_TYPE__SUPPORTED_CRS);
		}
		return supportedCRS;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<String> getSupportedFormat() {
		if (supportedFormat == null) {
			supportedFormat = new EDataTypeEList<String>(String.class, this, Wcs111Package.CONTENTS_TYPE__SUPPORTED_FORMAT);
		}
		return supportedFormat;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<OnlineResourceType> getOtherSource() {
		if (otherSource == null) {
			otherSource = new EObjectContainmentEList<OnlineResourceType>(OnlineResourceType.class, this, Wcs111Package.CONTENTS_TYPE__OTHER_SOURCE);
		}
		return otherSource;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case Wcs111Package.CONTENTS_TYPE__COVERAGE_SUMMARY:
				return ((InternalEList<?>)getCoverageSummary()).basicRemove(otherEnd, msgs);
			case Wcs111Package.CONTENTS_TYPE__OTHER_SOURCE:
				return ((InternalEList<?>)getOtherSource()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case Wcs111Package.CONTENTS_TYPE__COVERAGE_SUMMARY:
				return getCoverageSummary();
			case Wcs111Package.CONTENTS_TYPE__SUPPORTED_CRS:
				return getSupportedCRS();
			case Wcs111Package.CONTENTS_TYPE__SUPPORTED_FORMAT:
				return getSupportedFormat();
			case Wcs111Package.CONTENTS_TYPE__OTHER_SOURCE:
				return getOtherSource();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case Wcs111Package.CONTENTS_TYPE__COVERAGE_SUMMARY:
				getCoverageSummary().clear();
				getCoverageSummary().addAll((Collection<? extends CoverageSummaryType>)newValue);
				return;
			case Wcs111Package.CONTENTS_TYPE__SUPPORTED_CRS:
				getSupportedCRS().clear();
				getSupportedCRS().addAll((Collection<? extends String>)newValue);
				return;
			case Wcs111Package.CONTENTS_TYPE__SUPPORTED_FORMAT:
				getSupportedFormat().clear();
				getSupportedFormat().addAll((Collection<? extends String>)newValue);
				return;
			case Wcs111Package.CONTENTS_TYPE__OTHER_SOURCE:
				getOtherSource().clear();
				getOtherSource().addAll((Collection<? extends OnlineResourceType>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case Wcs111Package.CONTENTS_TYPE__COVERAGE_SUMMARY:
				getCoverageSummary().clear();
				return;
			case Wcs111Package.CONTENTS_TYPE__SUPPORTED_CRS:
				getSupportedCRS().clear();
				return;
			case Wcs111Package.CONTENTS_TYPE__SUPPORTED_FORMAT:
				getSupportedFormat().clear();
				return;
			case Wcs111Package.CONTENTS_TYPE__OTHER_SOURCE:
				getOtherSource().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case Wcs111Package.CONTENTS_TYPE__COVERAGE_SUMMARY:
				return coverageSummary != null && !coverageSummary.isEmpty();
			case Wcs111Package.CONTENTS_TYPE__SUPPORTED_CRS:
				return supportedCRS != null && !supportedCRS.isEmpty();
			case Wcs111Package.CONTENTS_TYPE__SUPPORTED_FORMAT:
				return supportedFormat != null && !supportedFormat.isEmpty();
			case Wcs111Package.CONTENTS_TYPE__OTHER_SOURCE:
				return otherSource != null && !otherSource.isEmpty();
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (supportedCRS: ");
		result.append(supportedCRS);
		result.append(", supportedFormat: ");
		result.append(supportedFormat);
		result.append(')');
		return result.toString();
	}

} //ContentsTypeImpl
